package com.itguigu.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

import java.sql.Array;
import java.sql.SQLOutput;
import java.util.Arrays;

@Component
@Aspect
public class Myadvice {

    @Pointcut("execution(String com.itguigu.Dao.impl.BookDaoImpl.findBook(..))")
    public void pt(){}
//
//    @Before("pt()")
//    public void before(JoinPoint jp){
//        Object[] args = jp.getArgs();
//        System.out.println(Arrays.toString(args));
//        System.out.println("before....");
//    }

//    @After("pt()")
//    public void after(){
//        System.out.println("after.....");
//    }
//
//    @Around("pt()")
//    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
//        System.out.println("around....");
//        return joinPoint.proceed();
//    }
//
    @AfterReturning(value = "pt()",returning = "ret")
    public void afterReturning(Object  ret){
        System.out.println("afterReturning...."+ret.toString());
    }
//
//    @AfterThrowing("pt()")
//    public void afterThrowing(){
//        System.out.println("afterThrowing....");
//    }

}
